import React, { Component } from 'react'
import './index.css'
// 子组件
const Fn = (props) => {
  console.log('接收到父组件', props)
  return (
    <div>
      <h2>子组件</h2>
      {props.children()}
    </div>
  )
}
class Title extends Component {
  render() {
    return <div className="title">{this.props.children}</div>
  }
}
// 父组件
export default class App extends Component {
  render() {
    return (
      <div>
        <h1>children属性使用</h1>
        <hr />
        <Fn test="123">
          {/* <h1>早上号</h1> */}
          {() => console.log(123)}
        </Fn>
        {/*  */}
        <Title>哈哈哈</Title>
      </div>
    )
  }
}
